package com.ecreditpal.audio;

import com.ecreditpal.audio.model.AudioModel.Text.Builder;
import com.ecreditpal.audio.model.AudioSession;
import io.netty.channel.ChannelHandlerContext;

/**
 * @author lifeng
 * @version 1.0 on 2018/7/8.
 */
public class AsrCallback {
    private ChannelHandlerContext ctx;
    private Builder builder;
    private AudioSession session;

    public AsrCallback(ChannelHandlerContext ctx,AudioSession session, Builder builder) {
        this.ctx = ctx;
        this.builder = builder;
        this.session = session;
    }

    public void sendMessage(String text) {
        session.setRecord(builder.getType(),builder.getBeginTime(),builder.getEndTime(),builder.getContent());
        builder.setContent(text);
        ctx.writeAndFlush(builder.build());
    }
}
